package com.devframe.component.ftlprocess.meta;

import com.devframe.component.ftlprocess.FTLProcessGlobalConstants;



/**
 * 数据集
 * @author  <b>詹保山</b>
 */
public class DataSet {
	private String id;

	/**
	 * 数据集的类型
	 */
	private int type;
	/**
	 * SQL 语句
	 */
	private String sql="";
	
	private String hql="";
	
	private String service;
	
	private String method;
	
	
	public DataSet() {
		super();
	}
	/**
	 * 用sql的方式
	 * @param id
	 * @param type
	 */
	public DataSet(String id, int type) {
		super();
		this.id = id;
		this.type=type;
	}

	/**
	 * 用sql的方式
	 * @param id
	 * @param type
	 * @param sql
	 */
	public DataSet(String id, int type,String sql) {
		super();
		this.id = id;
		this.type=type;
		this.sql = sql;
	}
	
	/**
	 * 用sql的方式
	 * @param type
	 * @param sql
	 */
	public DataSet( int type,String sql) {
		super();
		this.type=type;
		this.sql = sql;
	}
	/**
	 * 
	 * @param id data set Id
	 * @param type 类型
	 * @param beanId Spring Beanｉｄ
	 * @param beanMethod　Spring Bean mehtod
	 */
	public DataSet(String id,int type, String service,String method) {
		super();
		this.id = id;
		this.type=type;
		this.service = service;
		this.method=method;
	}
	/**
	 * 
	 * @param type 类型
	 * @param beanId Spring Beanｉｄ
	 * @param beanMethod　Spring Bean mehtod
	 */
	public DataSet(int type, String service,String method) {
		super();
		this.type=type;
		this.service = service;
		this.method=method;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public void setSql(String sql) {
		this.sql = sql;
	}
	public String getSql() {
		return sql;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public String getService() {
		return service;
	}
	public void setService(String service) {
		this.service = service;
	}
	public String getMethod() {
		return method;
	}
	public void setMethod(String method) {
		this.method = method;
	}
	public String toString() {
		StringBuffer sb=new StringBuffer(32);
		if(this.type==FTLProcessGlobalConstants.DATASET_TYPE_BEAN){
			sb.append("dataSet bean 类型：id=["+this.id+"],service=["+this.service+"],method=["+this.method+"]");
		}else if(this.type==FTLProcessGlobalConstants.DATASET_TYPE_SQL){
			sb.append("dataSet SQL 类型：id=["+this.id+"],sql=["+sql+"]");
		}else{
			sb.append("dataSet HQL 类型：id=["+this.id+"],hql=["+hql+"]");
		}
		return sb.toString();
	}
	public String getHql() {
		return hql;
	}
	public void setHql(String hql) {
		this.hql = hql;
	}

}
